<?php
session_start();
      if (isset($_SESSION['k_username'])) {
?>
<html>
<head>
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
<style type="text/css">
<!--
.Estilo1 {font-size: 24px}
-->
</style>
<title >Editar Socio</title>
<link rel="stylesheet" type="text/css" media="all" href="../../calendario/calendar-green.css" title="win2k-cold-1" /> 
 <!-- librería principal del calendario -->
 <script type="text/javascript" src="../../calendario/calendar.js"></script>

 <!-- librería para cargar el lenguaje deseado -->
  <script type="text/javascript" src="../../calendario/lang/calendar-es.js"></script>

  <!-- librería que declara la función Calendar.setup, que ayuda a generar un calendario en unas pocas líneas de código -->
  <script type="text/javascript" src="../../calendario/calendar-setup.js"></script>    
  <script type="text/javascript" src="../../js/funciones.js"></script>    

</head>
<body>
<?php 

  include('../../conexion.inc.php');
  $link = Conectarse();

mysql_select_db("gotica_sociosgotica",$link);
$valor=$_POST['valor'];

?>
<div align="center" class="Estilo1">Editar Socio</div>
<?
$sqll="SELECT * FROM socios WHERE idsocio=".$valor;
$resultl = mysql_query($sqll, $link);
$rowl= mysql_fetch_array($resultl);
?>
<div id="dperson">
<form method="post" action="editsocio.php"> 
<table class="one" >
<tr>
<td>
  Nombre </td>
  <td>
<?php 
 echo " <input type=\"hidden\" name=\"idsocio\" value=".$valor."   />";
 echo " <input type=\"text\" name=\"nombre\" value=\"".$rowl['Nombres']."\" maxlength=\"50\" size=\"50\"  />";
?>
  </td></tr>
<tr>
    <td>Apellido Paterno</td>
 <td>
<?php 
 echo " <input type=\"text\" name=\"appaterno\" value=\"".$rowl['ApPaterno']."\" maxlength=\"50\" size=\"50\"  />";
?>
</tr>
<tr>
    <td>Apellido Materno</td>
 <td>
<?php 
 echo " <input type=\"text\" name=\"apmaterno\" value=\"".$rowl['ApMaterno']."\" maxlength=\"50\" size=\"50\"  />";
?> 
  </td>
</tr>
<tr>
    <td>DNI</td>
 <td>
<?php 
echo "<input type=\"text\" name=\"dni\" maxlength=\"20\" value=\"".$rowl['DNI']."\"  />";
?>
    </td>
</tr>
<tr>

    <td>Direccion</td>
  
   <td> 
<?php 
 echo " <input type=\"text\" name=\"direccion\" value=\"".$rowl['Direccion']."\" maxlength=\"150\" size=\"50\" />";
?> 
   </td>
</tr>

<?php

$sql = "SELECT * FROM distrito";


$result = mysql_query($sql, $link);
echo "<tr>";
echo "<td>Distrito</td>";
echo "<td><select name=\"distrito\"  />";
$dis=1;
while ($row = mysql_fetch_array($result))
{
if ($rowl['IdDistrito']==$dis){
echo "<option selected value=\"".$row['IdDistrit']."\">";
echo $row['Distrito'];
echo "</option>";}
else
{
echo "<option value=\"".$row['IdDistrit']."\">";
echo $row['Distrito'];
echo "</option>";	
	}
	$dis++;
}
echo "</select></td>";
echo "</tr>";

  ?>
<tr>
<td>
</tr>
<tr>
<td>
Revista
</td>
<td>
<?php 
echo "<select name=\"revista\">";
if ($rowl['Revista']==1){
 echo " <option selected value=\"1\"   >Si</option>";
echo "<option value=\"0\">No</option>"; }
else
{
	echo " <option value=\"1\"   >Si</option>";
	echo "<option selected value=\"0\">No</option>";
	}
echo "</select>";
?> 
</td>
</tr>
<tr>
<td>
Telefono
</td>
<td>
<?php 
 echo " <input type=\"text\" name=\"telefono\" value=\"".$rowl['Telefono']."\" maxlength=\"10\" onkeypress=\"return permite(event, 'num')\"  / >";
?> 
</td>
</tr>
<tr>
<td>
Celular
</td>
<td>
<?php 
 echo " <input type=\"text\" name=\"celular\" value=\"".$rowl['Celular']."\" maxlength=\"10\" onkeypress=\"return permite(event, 'num')\"  / >";
?> 
</td>
</tr>
<?php

$sql3 = "SELECT * FROM sexo";
$result3 = mysql_query($sql3, $link);
echo "<tr>";
echo "<td>Sexo</td>";
echo "<td><select name=\"sexo\"  />";
$sexx=M;
while ($row3 = mysql_fetch_array($result3))
{
if($rowl['IdSexo']==$sexx){
echo "<option selected value=\"".$row3['IdSexo']."\">";
echo $row3['Sexo'];
echo "</option>";
}
else
{
echo "<option value=\"".$row3['IdSexo']."\">";
echo $row3['Sexo'];
echo "</option>";
}
}
echo "</select></td>";
echo "</tr>";


?>
<tr>
<td>
Fecha Nacimiento</td>
<td>
<?php 
 echo " <input type=\"text\" name=\"fechnac\" value=\"".$rowl['FechaNacimiento']."\" maxlength=\"10\"   / > ";
?> 
</td>
</tr>
<tr>
<td>
Email</td>
<td>
<?php 
 echo " <input type=\"text\" name=\"email\"  value=\"".$rowl['Email']."\" maxlength=\"50\" size=\"30\"  / >";
echo "<input type=\"hidden\" value=".$_POST['page']." name=\"page\" />"; 
mysql_close();
?> 
</td>
</tr>
<tr>
<td>
<input type="submit" value="Guardar" name="enviar" />
</td>
<td>
<input type="reset" value="Limpiar" />
</td>
</tr>
</table>
</form>
</div>
<table><tr><td>
<form method="post" action="tiposocio.php"> 
<? echo " <input type=\"hidden\" name=\"idsocio\" value=".$valor."   />";
 ?>
<input type="submit" value="Ver Tipo Socio" name="tiposocio" />
</form></td><td>
<form method="post" action="renovacion.php"> 
<? echo " <input type=\"hidden\" name=\"idsocio\" value=".$valor."   />";
 ?>
<input type="submit" value="Renovacion" name="renovacion" />
</form></td></tr></table>
<div align="center" >
<a href="javascript:javascript:history.go(-1)">Atras</a></div>
</body>
</html>
<?
}else
{
	echo "<SCRIPT LANGUAGE=\"javascript\">";
echo "location.href = \"index.php\"";
echo "</SCRIPT>";
	}
?>
